<template>
  <el-dialog
    title="工单配置"
    :visible.sync="dialogVisible"
    width="30%"
    :before-close="handleClose"
    :close-on-click-modal="false"
  >
    <el-form ref="form" :model="form" label-width="150px">
      <el-form-item
        label="补货警戒线："
        prop="num"
        :rules="[{ required: true, message: '请输入值', trigger: 'change' }]"
      >
        <el-input-number
          v-model="form.num"
          controls-position="right"
          :min="1"
          :max="100"
        ></el-input-number>
      </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="dialogVisible = false">取 消</el-button>
      <el-button type="primary" @click="submit">确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>
import { autoSupplyConfig, supplyAlertValue } from '@/api/gdInfo'
export default {
  name: 'Dkd3WarnDialog',

  data () {
    return {
      dialogVisible: false,
      form: {
        num: 1
      }
    }
  },

  mounted () {},

  methods: {
    handleClose () {
      this.dialogVisible = false
    },
    async submit () {
      this.handleClose()
      await autoSupplyConfig({ alertValue: this.form.num })
      // console.log(res)
      this.$emit('flash')
    },
    async getSupplyAlertValue () {
      const res = await supplyAlertValue()
      this.form.num = res
    }
  }
}
</script>

<style lang="less" scoped>
/deep/.el-dialog__footer {
  text-align: center;
}
/deep/.el-form-item__content {
  margin: 0 !important;
  width: 100%;
  .el-input-number {
    width: 80%;
    .el-input {
      width: 100%;
    }
  }
}
/deep/.el-dialog__header {
  // float: left;
  display: flex;
  justify-content: space-between;
}
/deep/.el-form-item__label {
  width: auto !important;
  padding: 0;
}
</style>
